<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<title>1.1信息与编码 | pansis.io</title>
<link rel="shortcut icon" href="https://github.pansis.site/favicon.ico">
<link href="https://github.pansis.site/styles/main.css" rel="stylesheet">
<link href="//at.alicdn.com/t/c/font_1678829_b85ccgkdqkr.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.css" rel="stylesheet">
<link rel="alternate" type="application/rss+xml" title="pansis.io » Feed" href="https://github.pansis.site/atom.xml">
        <meta name="description" content="信息与编码
一、信息量的度量
1、定义： 面临N中同等可能的选择，给定一个信息，能将范围缩小至M，则该信息提供的信息量为log2(N/M)log_2(N/M)log2​(N/M)
2、公式： log2(N/M)log_2(N/M)log2​..." />
        <meta name="keywords" content="vlsi" />
        <!-- OG -->
        <meta property="og:locale" content="zh_CN">
        <meta property="og:title" content="1.1信息与编码" />
        <meta property="og:type" content="article" />
        <meta property="og:description" content="信息与编码
一、信息量的度量
1、定义： 面临N中同等可能的选择，给定一个信息，能将范围缩小至M，则该信息提供的信息量为log2(N/M)log_2(N/M)log2​(N/M)
2、公式： log2(N/M)log_2(N/M)log2​...">
        <meta property="og:url" content="https://github.pansis.site/post/1.1信息与编码/" />
        <meta property="og:site_name" content="pansis.io">
        <meta property="og:updated_time" content="2023-09-11">
        <meta property="og:image" content="" />
        <meta property="og:image:secure_url" content="">
        <meta property="og:image:alt" content="1.1信息与编码">
        <!-- Twitter (post.ejs) -->
        <meta name="twitter:card" content="summary_large_image">
        <meta name="twitter:title" content="1.1信息与编码">
        <meta name="twitter:description" content="信息与编码
一、信息量的度量
1、定义： 面临N中同等可能的选择，给定一个信息，能将范围缩小至M，则该信息提供的信息量为log2(N/M)log_2(N/M)log2​(N/M)
2、公式： log2(N/M)log_2(N/M)log2​...">
        <!-- <meta name="twitter:site" content="@WBoy0609">
        <meta name="twitter:creator" content="@WBoy0609"> -->
        <meta name="twitter:image" content="">
</head>

<body>
    <div class="main animated">
        <div class="header animated fadeInDown">
    <div class="site_title_container">
        <div class="site_title">
            <a href="https://github.pansis.site">pansis.io</a>
        </div>
    </div>
    <div class="my_socials">
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
        <a href="https://github.pansis.site/atom.xml" title="rss" target="_blank"><i class="iconfont icon-rss"></i></a>
    </div>
</div>

    <div class="header_menu">
        
            
                <a href="/" class="menu">首页</a>
            
        
            
                <a href="/tag/GWAaV2nvk/" class="menu">程序设计课程</a>
            
        
            
                <a href="/tag/24hangc" class="menu">比赛</a>
            
        
            
                <a href="/tag/L7r9STb75/" class="menu">Python教程</a>
            
        
            
                <a href="/tags" class="menu">分类</a>
            
        
        <div class="gridea-search-div">
            <form id="gridea-search-form" action="https://github.pansis.site/search/">
                <input class="gridea-search-input" autocomplete="off" spellcheck="false" name="q"/>
            </form>
        </div>
    </div>

            <div class="autopagerize_page_element">
                <div class="content">
                    <div class="post_page">
                        <div class="post animated fadeInDown">
                            <div class="post_title post_detail_title">
                                <h2>
                                    1.1信息与编码
                                </h2>
                                <span class="article-info">
                                    2023-09-11, 604 words, 3 min read
                                </span>
                            </div>
                            <div class="post_content markdown">
                                <p class="md_block">
                                    <span class="md_line md_line_start md_line_end">
                                        <h1 id="信息与编码">信息与编码</h1>
<h2 id="一-信息量的度量">一、信息量的度量</h2>
<p><strong>1、定义：</strong> 面临N中同等可能的选择，给定一个信息，能将范围缩小至M，则该信息提供的信息量为<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>l</mi><mi>o</mi><msub><mi>g</mi><mn>2</mn></msub><mo>(</mo><mi>N</mi><mi mathvariant="normal">/</mi><mi>M</mi><mo>)</mo></mrow><annotation encoding="application/x-tex">log_2(N/M)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.30110799999999993em;"><span style="top:-2.5500000000000003em;margin-left:-0.03588em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathdefault" style="margin-right:0.10903em;">N</span><span class="mord">/</span><span class="mord mathdefault" style="margin-right:0.10903em;">M</span><span class="mclose">)</span></span></span></span></p>
<p><strong>2、公式：</strong> <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>l</mi><mi>o</mi><msub><mi>g</mi><mn>2</mn></msub><mo>(</mo><mi>N</mi><mi mathvariant="normal">/</mi><mi>M</mi><mo>)</mo></mrow><annotation encoding="application/x-tex">log_2(N/M)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.30110799999999993em;"><span style="top:-2.5500000000000003em;margin-left:-0.03588em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathdefault" style="margin-right:0.10903em;">N</span><span class="mord">/</span><span class="mord mathdefault" style="margin-right:0.10903em;">M</span><span class="mclose">)</span></span></span></span></p>
<p><strong>3、例子：</strong> 投掷两枚筛子的结果 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>l</mi><mi>o</mi><msub><mi>g</mi><mn>2</mn></msub><mo>(</mo><mn>36</mn><mi mathvariant="normal">/</mi><mn>1</mn><mo>)</mo><mo>=</mo><mn>5.2</mn><mi>b</mi><mi>i</mi><mi>t</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">log_2(36/1)=5.2bits</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.30110799999999993em;"><span style="top:-2.5500000000000003em;margin-left:-0.03588em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord">3</span><span class="mord">6</span><span class="mord">/</span><span class="mord">1</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.69444em;vertical-align:0em;"></span><span class="mord">5</span><span class="mord">.</span><span class="mord">2</span><span class="mord mathdefault">b</span><span class="mord mathdefault">i</span><span class="mord mathdefault">t</span><span class="mord mathdefault">s</span></span></span></span></p>
<h2 id="二-编码">二、编码</h2>
<p><strong>1、定义：</strong> 编码是对信息进行表征的过程</p>
<p><strong>2、数制：</strong> 表示数量的规则（对数进行编码）（二进制、十进制等）</p>
<p><strong>3、码制：</strong> 表示事物的规则（对事物进行编码）（对符号、文字的编码）</p>
<h2 id="三-数制">三、数制</h2>
<p>**1、**进位计数制是最常见的数制。</p>
<p>**2、R进制：**逢R进一成为R进制。</p>
<p>​     <strong>进位基数</strong> ：R，即每个数位 可以出现的数码个数</p>
<img src="http://cos.pansis.site/202309111020178.png" alt="image-20230911102031077" style="zoom: 50%;" />
<img src="http://cos.pansis.site/202309111020813.png" alt="image-20230911102056779" style="zoom:50%;" />
<p><strong>3、R进制数值大小公式</strong></p>
<img src="http://cos.pansis.site/202309111024355.png" alt="image-20230911102140677" style="zoom:50%;" />
<h2 id="四-进制之间的相互转换">四、进制之间的相互转换</h2>
<h4 id="1-r进制转十进制">1、R进制转十进制</h4>
<p>直接使用R进制数值大小公式即可</p>
<img src="http://cos.pansis.site/202309111024997.png" alt="image-20230911102403005" style="zoom:50%;" />
<h4 id="2-十进制转二进制">2、十进制转二进制</h4>
<p>整数的转换:整数连除，取余逆序</p>
<img src="http://cos.pansis.site/202309111027247.png" alt="image-20230911102734209" style="zoom:50%;" />
<p>纯小数的转换：小数连乘，取整顺序</p>
<img src="http://cos.pansis.site/202309111028072.png" alt="image-20230911102819004" style="zoom:50%;" />
<p>十进制转其他进制类似于十进制转二进制。</p>
<h4 id="3-二进制互转八进制">3、二进制互转八进制</h4>
<p>二进制转八进制：</p>
<p>将<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mn>10011010.111101</mn><msub><mo>)</mo><mn>2</mn></msub></mrow><annotation encoding="application/x-tex">(10011010.111101)_2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mord">0</span><span class="mord">0</span><span class="mord">1</span><span class="mord">1</span><span class="mord">0</span><span class="mord">1</span><span class="mord">0</span><span class="mord">.</span><span class="mord">1</span><span class="mord">1</span><span class="mord">1</span><span class="mord">1</span><span class="mord">0</span><span class="mord">1</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.30110799999999993em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>转 换为八进制数</p>
<img src="http://cos.pansis.site/202309111030109.png" alt="image-20230911103035072" style="zoom: 33%;" />
<img src="http://cos.pansis.site/202309111030455.png" alt="image-20230911103044422" style="zoom:50%;" />
<p>八进制转二进制：</p>
<p>将<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mn>316.54</mn><msub><mo>)</mo><mn>8</mn></msub></mrow><annotation encoding="application/x-tex">(316.54)_8</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">3</span><span class="mord">1</span><span class="mord">6</span><span class="mord">.</span><span class="mord">5</span><span class="mord">4</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.30110799999999993em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">8</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>转换为二进制数</p>
<img src="http://cos.pansis.site/202309111033493.png" alt="image-20230911103350446" style="zoom:50%;" />
<p>二进制互转十六进制与此类似。</p>
<h4 id="4-八进制互转十六进制">4、八进制互转十六进制</h4>
<p>以二进制位中介进行转换</p>
<h2 id="五-二进制数的运算">五、二进制数的运算</h2>
<h4 id="1-原码补码反码">1、原码补码反码</h4>
<ul>
<li>
<p><strong>原码：</strong> 符号位在前，0表示正数，1表示负数，数值位跟随符号位后面。</p>
</li>
<li>
<p><strong>反码：</strong> 正数的反码为其本身</p>
<p>​           负数的反码通过其数值位逐位取反得到</p>
</li>
<li>
<p><strong>补码：</strong> 正数的补码为其本身</p>
<p>​            负数的补码是其绝对值的原码取反加一。</p>
</li>
</ul>
<h4 id="2-运算实例">2、运算实例</h4>
<p>用补码表示有符号数，则可以用加法运算来实现减法运算， 同时不影响运算的正确性。</p>
<p>加法/减法：（补码直接计算，如果多出来一位，该位舍弃）</p>
<img src="http://cos.pansis.site/202309111046935.png" alt="image-20230911104628891" style="zoom:33%;" />
<p>乘法:</p>
<img src="http://cos.pansis.site/202309111052866.png" alt="image-20230911105243835" style="zoom:33%;" />
<p>除法:</p>
<img src="http://cos.pansis.site/202309111053234.png" alt="image-20230911105306182" style="zoom:33%;" />
<p>六、码制</p>
<p>1、BCD码</p>
<ul>
<li>定义：用二进制码元来表示十进制数的代码，也 称为十进制码</li>
<li>BCD码不是二进制数</li>
</ul>
<img src="http://cos.pansis.site/202309111055943.png" alt="image-20230911105546918" style="zoom:33%;" />
<p>2、ASCII码</p>
<p>略</p>
<br />
                                            
                                </p>
                            </div>
                            <div class="post_footer">
                                
                                    <div class="meta">
                                        <div class="info"><span class="field tags"><i class="iconfont icon-tag-sm"></i>
                                                
                                                    <a href="https://github.pansis.site/tag/vlsi/" class="article-info">
                                                        vlsi
                                                    </a>
                                                    
                                            </span>
                                        </div>
                                    </div>
                                    
                                        
                                            <div class="next-post" style="margin-top: 20px;">
                                                <div class="next">下一篇</div>
                                                <a href="https://github.pansis.site/post/1.1惯性导航概论/">
                                                    <h3 class="post-title">
                                                        1.1惯性导航概论
                                                    </h3>
                                                </a>
                                            </div>
                                            
                            </div>
                        </div>
                        
                            
                                <link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<div id="gitalk-container" style="padding-bottom: 20px;"></div>
<script>
    var pageId = (location.pathname).substring(1, 49) // Ensure uniqueness and length less than 50
    pageId = pageId.endsWith('/') ? pageId.slice(0, -1) : pageId // 以斜杠结尾则去除
    var gitalk = new Gitalk({
        clientID: '9d5eba33618472c44a07',
        clientSecret: '065a85ed04333ceebfc4f01d7ca1674175730339',
        repo: 'fzxl2003.github.io',
        owner: 'fzxl2003',
        admin: ['fzxl2003'],
        id: pageId,
        distractionFreeMode: false  // Facebook-like distraction free mode
    })
    gitalk.render('gitalk-container')
</script>
                                    
                                        
                                                    
                    </div>
                </div>
            </div>
    </div>
    <div class="footer">
    
    <div class="powered_by">
        <a href="https://codeberg.org/kytrun/gridea-theme-one" target="_blank">Theme One,</a>
        <a href="https://open.gridea.dev/" target="_blank">Powered by Gridea&#65281;</a>
    </div>
    
    
        <div class="footer_slogan">
            Powered by <a href="https://github.com/getgridea/gridea" target="_blank">Gridea</a>
        </div>
    
    <div id="back_to_top" class="back_to_top">
        <span>△</span>
    </div>
    
</div>

<script src="https://github.pansis.site/media/scripts/util.js"></script>
        <link rel="stylesheet" href="//unpkg.com/@highlightjs/cdn-assets@11.5.1/styles/default.min.css">
        <script src="//unpkg.com/@highlightjs/cdn-assets@11.5.1/highlight.min.js"></script>
        <script>hljs.highlightAll();</script>
</body>

</html>